/*
 * FNISVGEditor - JavaScript - based editor for SVG graphics 
 * Copyright (C) 2008 - 2009 Antti Leppä / Foyt
 * http://www.foyt.fi
 * 
 * License: 
 * 
 * Licensed under GNU Lesser General Public License Version 2.1 or later (the "LGPL") 
 * http://www.gnu.org/licenses/lgpl.html
 */
FNISVGEditorNewDocumentPlugin = Class.create(FNISVGEditorPlugin, {
  initialize: function($super, editorInstance, pluginURL) {
    $super(editorInstance, pluginURL);    
  	var button = new FNIPushButton({});	
    button.setImage(this.getPluginURL() + "/gfx/icons/22x22/actions/x-office-drawing-new.png");
  	button.addListener('buttonClick', this, this._onButtonClick);
    button.setTooltip(SVGLocale.getText("newdocumentPlugin_buttonTooltip"));
    editorInstance.registerToolbarItem('newDocument', button);
  },
  getName: function () {
    return "newdocument";
  },
  _onButtonClick: function (event) {
    this.getEditorInstance().getSVGDocument().removeAllElements();
    this.getEditorInstance().getUndoManager().clearStack();
  }     
});

document.fire("svgEditorPluginLoaded:newdocument", { pluginClass: FNISVGEditorNewDocumentPlugin });
